#pragma once
#include <stack>
#include "matrix.h"
#include "vector3.h"

namespace krryn{
namespace math{
	class matrix_stack{
	public:
		// creates a matrix stack with a single 
		// identity matrix as the first element
		matrix_stack(){
			math::matrix l_Identity;
			m_Stack.push(l_Identity);
		}

		void push(){
			// copy the top element and advance the stack
			m_Stack.push(m_Stack.top());
		}

		void pop(){
			m_Stack.pop();
		}

		const matrix &top(){
			return m_Stack.top();
		}

		// change the current matrix to the identity matrix
		void identity(){
			m_Stack.top().identity();
		}

		// multiply the current matrix with the given matrix
		void concatenate(const matrix &a_Matrix){
			m_Stack.top().concatenate(a_Matrix);
		}

		// translate the current matrix with the given vector
		void translate(const vector3f &a_Vector){
			m_Stack.top().translate(a_Vector);
		}

		// scale the current matrix with the given vector
		void scale(const vector3f &a_Vector){
			m_Stack.top().scale(a_Vector);
		}
	private:
		std::stack<matrix> m_Stack;
	};
}
}